<template>
    <div>
        <h3>添加</h3>
        <table>
            <tr>
                <td>用户名</td>
                <td>
                    <input type="text" v-model="data.yhm">
                </td>
            </tr>
            <tr>
                <td>密码</td>
                <td>
                    <input type="text" v-model="data.mm">
                </td>
            </tr>
            <tr>
                <td>性别</td>
                <td>
                    <input type="text" v-model="data.xb">
                </td>
            </tr>
            <tr>
                <td>地址</td>
                <td>
                    <input type="text" v-model="data.dz">
                </td>
            </tr>
            <tr>
                <td>时长</td>
                <td>
                    <input type="text" v-model="data.sj">
                </td>
            </tr>
            <tr>
                <td>开始时间</td>
                <td>
                    <input type="date" v-model="data.dqsj">
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="button" value="添加" @click="add">
                </td>
            </tr>
        </table>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';

const data=ref({
    "id": 0,
  "yhm": "",
  "mm": "",
  "xb": "",
  "dz": "",
  "sj": 0,
  "dqsj": ""
})

const add=()=>{
    axios.post("https://localhost:7234/api/we/add",data.value).then(res=>{
        if(res.data>0){
            alert("添加成功")
              location.href="/xs"
        }else{
            alert("添加失败")
        }
    })
}

</script>

<style scoped>

</style>